.TH rewise 1 "16 October 2024" "version 0.3.0" 

.SH NAME
.B rewise
- Extract files from Wise installers without executing them.


.SH SYNOPSIS
.B rewise
.RB OPERATION
.RB [OPTIONS]
.RB INPUT_FILE


.SH DESCRIPTION
.B rewise
Reverse Engineering Wise - The aim of this project is to extract assets from
old game installers made with Wise installer without executing the PE/NE file
(.exe), so they can be used with free software implementations of the game
engine.

The known working Wise installers are released from 1999 to 2004, the PE build
date of those installers are between 1998 and 2001.

Filtering files by language or components is still experimental.


.SH OPERATION
Specifying an OPERATION is mandatory. Exactly one operation is allowed per
execution.

All files that REWise does output will be overwritten when they exist!

.TP
.B -x --extract <OUTPUT_PATH>
Extract files. Existing files in the OUTPUT_PATH will be overwritten!

.TP
.B -r --raw <OUTPUT_PATH>
Extract all files in the overlay data. Filename format will be
`EXTRACTED_%09u`. The extra files are files only used by the installer
and would not be installed normally. This operation is for debugging
purposes. Existing files in the OUTPUT_PATH will be overwritten!

.TP
.B -l --list
This will list all files that would be installed by the installer, TMP
installer files are not listed. It will also print the total size of the listed
files at the end.

.TP
.B -V --verify
Run extract without actually outputting files, CRC32s will be checked.

.TP
.B -0 --raw-verify
Run raw extract without actually outputting files, CRC32s will be checked.

.TP
.B -Z --script-debug
Print parsed WiseScript.bin, this is only available when compiled with
REWISE_DEBUG.

.TP
.B -v --version
Print version and exit.

.TP
.B -h --help
Print help and exit.


.SH OPTIONS (--list)
.TP
.B -e --extended
Also print language and component per file. Use this to see what
language indexes and components names are available.

.SH OPTIONS (--extract, --list, --verify)
.TP
.B -f --filter <FILTER>
Filter files based on their filepath. Multiple of these filters may
be set. '*' will match anything, use '\*' to escape. The matching will
be case sensitive and non greedy.

.TP
.B -F --file-filter <FILTER_FILE>
Read file filters from a file. One filter per line, the format is the
same as `--filter` so the match all character '*' is also allowed.
Line should end with only '\\n'. The maximum line length is `WIN_PATH_MAX
* 2`, where `WIN_PATH_MAX` is `260`. The `* 2` is to support `UTF-8`,
so in most cases the line would be no longer then `260`. When FILTER_FILE
is a empty file, it won't do any filtering!

.TP
.B -g --language <INDEX>
Filter files by language index, files that have not set a language will
be included nonetheless.

.TP
.B -c --components <NAME>
Filter files by components name, files that are not part of a component
will be included nonetheless.


.SH OPTIONS (--list, --script-debug)
.TP
.B -n --no-extract
Don't extract anything. Use WiseScript.bin at the given TMP_PATH, it
won't delete it.


.SH OPTIONS (any)
.TP
.B -p --preserve
Don't delete WiseScript.bin from TMP_PATH

.TP
.B -t --tmp-path <TMP_PATH>
Set temporary path. Run `rewise --help` to find the default TMP_PATH (it should
be in the description of -t --tmp-path).

.TP
.B -d --debug
Print debug info. This is only available when compiled with REWISE_DEBUG.

.TP
.B -s --silent
Be silent, don't print anything.


.SH INPUT_FILE
The Wise installer file (.exe), this is is mandatory.


.SH EXIT STATUS
The exit status is 0 on success, greater then zero on error.

See `/src/errors.h` for specifics.


.SH NOTES
.IP \[bu] 2
Path to directory OUTPUT_PATH and TMP_PATH should exist, be writable and
of-course there should be enough free-space. There should be at-least 1 MiB of
free-space at the TMP_PATH, for the OUTPUT_PATH with the use of --extract, you
can use --list fist to determine the required free-space.

.IP \[bu]
REWise is only tested on Little Endian systems. Did you try REWise on a Big-
Endian system then please report your results by opening a new issue at
<https://codeberg.org/CYBERDEV/REWise/issues>

.IP \[bu]
REWise will not delete/cleanup extracted files when the process fails somehow,
TMP files however will be deleted unless --preserve is given.


.SH EXAMPLES
.B Extracting files as the installer would have:
.RS 2
rewise -x /path/to/extract/files/to/ /path/to/Setup.exe
.RE

.B List files:
.RS 2
rewise -l /path/to/Setup.exe
.RE

.B Extended list files:
.RS 2
rewise -le /path/to/Setup.exe
.RE

.B Extended list files with only the first language and components 'A',
note that default files (without language or components set) will
always be included:
.RS 2
rewise -le -g0 -c"A" /path/to/Setup.exe
.RE

.B List only *.pk3 for the first language:
.RS 2
rewise -g0 -f"*.pk3" -l /path/to/Setup.exe
.RE

.B Extracting files for language index `1`:
.RS 2
rewise -g1 -x /path/to/extract/files/to/ /path/to/Setup.exe
.RE


.SH LICENSE
REWise is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

REWise is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.


.SH BUGS
For known issues and reporting new issues: see
<https://codeberg.org/CYBERDEV/REWise/issues>.


.SH HOMEPAGE
https://codeberg.org/CYBERDEV/REWise
